<?php
// 抽奖码

namespace app\shop\controller;

use think\Session;
use think\Controller;
use app\shop\model\GoodsType as GoodsTypeModel;
use app\shop\model\LotteryCode as LotteryCodeModel;

class LotteryCode extends Controller
{

    public function index(GoodsTypeModel $goodsType, LotteryCodeModel $lotteryCode)
    {
        // 会员ID
        $member_id = Session::get('member_id');

        $data = $lotteryCode->where('member_id', $member_id)->select();

        // 获取商品分类信息
        $type_arr = $goodsType->where(['status' => 1])->field('id,parenTid,title')->select();
        $menu = get_cate($type_arr);


        return $this->fetch('', [
            'menu'      => $menu,
            'data'      => $data,
            'mate_head' => '我的抽奖码'
        ]);
    }
}